*------------------------------------------------------------------------------*
log using "FPA_Manuscript_Replication_Log"

*------------------------------------------------------------------------------*
* Replication file for "Do Parties Matter? Party Positions and European Voters’ Attitudes Towards Economic and Political Globalization" 
* Alex Honeker 
* October/11/2023
*------------------------------------------------------------------------------*


*------------------------------------------------------------------------------*
* Figure 1. Party Elites’ Stances on Globalization Issues
*------------------------------------------------------------------------------*

*Load Dataset 
use "CHES_Dataset.dta", clear

*Make sure to install packages "gr0070" and "g538schemes" to get the color schemes used below   


*Graph Figure 1a (Free Trade)
bysort parfam : egen m_protrade=mean(protrade)
bysort parfam : egen m_lrgen=mean(lrgen)

twoway (scatter m_protrade m_lrgen if parfam==1, mcolor(black) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5) legend(off)) || ///
	(scatter m_protrade m_lrgen if parfam==2, mcolor(plb2) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_protrade m_lrgen if parfam==3, mcolor("240 167 10") msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_protrade m_lrgen if parfam==4, mcolor(dkorange) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_protrade m_lrgen if parfam==5, mcolor(plr1) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_protrade m_lrgen if parfam==6, mcolor(maroon) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_protrade m_lrgen if parfam==7, mcolor(plg3) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)), ytitle("Protectionist vs. Pro-Trade", size(medlarge)) xtitle("Left-Right", size(medlarge)) ylabel(0(2)10) xlabel(0(2)10) yline(5, lcolor(gray)) xline(5, lcolor(gray)) 
	
graph export "CHES_Position_Trade.png", as(png)



*Graph Figure 1b (Single Market) 
bysort parfam : egen m_eu_intmark=mean(eu_intmark)

twoway (scatter m_eu_intmark m_lrgen if parfam==1, mcolor(black) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5) legend(off)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==2, mcolor(plb2) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==3, mcolor("240 167 10") msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==4, mcolor(dkorange) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==5, mcolor(plr1) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==6, mcolor(maroon) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_intmark m_lrgen if parfam==7, mcolor(plg3) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)), ytitle("Anti-Single Market vs. Pro-Single Market", size(medlarge)) xtitle("Left-Right", size(medlarge)) ylabel(1(1)7) xlabel(0(2)10) yline(4, lcolor(gray)) xline(5, lcolor(gray))	

graph export "CHES_Position_SingleMarket.png", as(png)


*Figure 1c (EU) 
bysort parfam : egen m_eu_position=mean(eu_position)

twoway (scatter m_eu_position m_lrgen if parfam==1, mcolor(black) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5) legend(off)) || ///
	(scatter m_eu_position m_lrgen if parfam==2, mcolor(plb2) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_position m_lrgen if parfam==3, mcolor("240 167 10") msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_position m_lrgen if parfam==4, mcolor(dkorange) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_position m_lrgen if parfam==5, mcolor(plr1) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_position m_lrgen if parfam==6, mcolor(maroon) msymbol(circle) msize(medlarge) mla(parfam) mlabcolor(gs5)) || ///
	(scatter m_eu_position m_lrgen if parfam==7, mcolor(plg3) msymbol(circle)  msize(medlarge) mla(parfam) mlabcolor(gs5)), ytitle("Anti-EU vs. Pro-EU", size(medlarge)) xtitle("Left-Right", size(medlarge)) ylabel(1(1)7) xlabel(0(2)10) yline(4, lcolor(gray)) xline(5, lcolor(gray))

graph export "CHES_Position_EU.png", as(png)



*Load Dataset 
use "CMP_Dataset.dta", clear


*Graph Figure 1d (Internationalism)
bysort parfam2 : egen m_rile=mean(rile)
bysort parfam2 : egen m_net_internat=mean(net_internat)

twoway (scatter m_net_internat m_rile if parfam2==1, mcolor(maroon) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5) legend(off)) || ///
	(scatter m_net_internat m_rile if parfam2==2, mcolor(plg3) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)) || ///
	(scatter m_net_internat m_rile if parfam2==3, mcolor(plr1) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)) || ///
	(scatter m_net_internat m_rile if parfam2==4, mcolor("240 167 10") msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)) || ///
	(scatter m_net_internat m_rile if parfam2==5, mcolor(plb2) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)) || ///
	(scatter m_net_internat m_rile if parfam2==6, mcolor(dkorange) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)) || ///
	(scatter m_net_internat m_rile if parfam2==7, mcolor(black) msize(medlarge) msymbol(circle) mla(parfam2) mlabcolor(gs5)), ytitle("Net Internationalism", size(medlarge)) xtitle("Left-Right", size(medlarge)) yline(0, lcolor(gray)) xline(0, lcolor(gray)) ylabel(-.1(.5)3) xlabel(-25(5)20) 
	
graph export "CMP_Position_Intl.png", as(png)



*------------------------------------------------------------------------------*
* Figure 2. The Effect of Party Positions on Voters’ Support for Economic Globalization
*------------------------------------------------------------------------------*

*Load Dataset 
use "ISSP_Dataset.dta", clear 

*Make sure to install package "st0085_2" for the "eststo" command to store model estimates 


*Figure 2 (top) - Model 2 in Table C1 in Appendix 
eststo: quietly mixed n_econ_glob ///
	n_party_trade_pre2013 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust)   
estimates store M2


*Figure 2 (bottom) - Model 1 in Table C1 in Appendix 
eststo: quietly mixed n_econ_glob ///
	n_party_intmark_2010 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust)   
estimates store M1


*Export Table: 
esttab M1 M2 using Fig2_TabC1.rtf, replace r2 se label star(* .1 ** .05 *** .01) scalars("ll Log Lik." "chi2 Chi-Squared" aic bic N)  nobaselevels 


*Graph Coefficient Plot (Figure 2 - Top) 
estimates restore M2 

margins, dydx(n_party_trade_pre2013 ///
	n_nationalism n_xenophobia n_isolationism ///
	n_educ_cat manufacture n_c_rti offshorable_bl n_rti_offshor ///
	unemployed union female n_age) post

marginsplot, horizontal xline(0, lc(blue)) yscale(reverse) recast(scatter) ///
	xtitle("Effects on Attitudes Towards Economic Globalization") ///
	plot1opts(msymbol(circle) mcolor(plr2)) ciopts(lc(plr2)) derivlabels ///
	ytitle("") title("")

graph export "Fig2_Top.png", width(6000) replace


*Graph Coefficient Plot (Figure 2 - Bottom) 
estimates restore M1

margins, dydx(n_party_intmark_2010 ///
	n_nationalism n_xenophobia n_isolationism ///
	n_educ_cat manufacture n_c_rti offshorable_bl n_rti_offshor ///
	unemployed union female n_age) post

marginsplot, horizontal xline(0, lc(blue)) yscale(reverse) recast(scatter) ///
	xtitle("Effects on Attitudes Towards Economic Globalization") ///
	plot1opts(msymbol(circle) mcolor(plr2)) ciopts(lc(plr2)) derivlabels ///
	ytitle("") title("")

graph export "Fig2_Bottom.png", width(6000) replace



*------------------------------------------------------------------------------*
* Figure 3. The Effect of Party Positions on Voters’ Support for Political Globalization
*------------------------------------------------------------------------------*

*Figure 3 (top) - Model 5 in Table C1 in Appendix 
eststo: quietly mixed n_pol_glob ///
	n_party_EU_2010 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust)   
estimates store M5


*Figure 3 (bottom) - Model 6 in Table C1 in Appendix 
eststo: quietly mixed n_pol_glob ///
	n_party_internat_pre2013 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust)   
estimates store M6


*Export Table: 
esttab M5 M6 using Fig3_TabC1.rtf, replace r2 se label star(* .1 ** .05 *** .01) scalars("ll Log Lik." "chi2 Chi-Squared" aic bic N)  nobaselevels 


*Graph Coefficient Plot (Figure 3 - Top) 
estimates restore M5

margins, dydx(n_party_EU_2010 ///
	n_nationalism n_xenophobia n_isolationism ///
	n_educ_cat manufacture n_c_rti offshorable_bl n_rti_offshor ///
	unemployed union female n_age) post

marginsplot, horizontal xline(0, lc(blue)) yscale(reverse) recast(scatter) ///
	xtitle("Effects on Attitudes Towards Political Globalization") ///
	plot1opts(msymbol(circle) mcolor(plr2)) ciopts(lc(plr2)) derivlabels ///
	ytitle("") title("")

graph export "Fig3_Top.png", width(6000) replace


*Graph Coefficient Plot (Figure 3 - Bottom) 
estimates restore M6

margins, dydx(n_party_internat_pre2013 ///
	n_nationalism n_xenophobia n_isolationism ///
	n_educ_cat manufacture n_c_rti offshorable_bl n_rti_offshor ///
	unemployed union female n_age) post

marginsplot, horizontal xline(0, lc(blue)) yscale(reverse) recast(scatter) ///
	xtitle("Effects on Attitudes Towards Political Globalization") ///
	plot1opts(msymbol(circle) mcolor(plr2)) ciopts(lc(plr2)) derivlabels ///
	ytitle("") title("")

graph export "Fig3_Bottom.png", width(6000) replace



*------------------------------------------------------------------------------*
* Figure 4. The Effect of Party Cues on Voters’ Support for Economic and Political Globalization
*------------------------------------------------------------------------------*

*Figure 4 (top) - Model 1 in Table C7 in Appendix 
eststo: quietly mixed n_econ_glob ///
	ib10.parfam_CMP_2 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust) 
estimates store M1


*Figure 4 (bottom) - Model 3 in Table C7 in Appendix
eststo: quietly mixed n_pol_glob ///
	ib10.parfam_CMP_2 n_nationalism n_xenophobia n_isolationism n_educ_cat ///
	manufacture n_c_rti offshorable_bl n_rti_offshor unemployed ///
	union female n_age n_ln_gdppc n_econ_open n_socialexp_eu ///
	if euro_sample==1, ||country_year: , vce(robust) 
estimates store M3


*Export Table: 
esttab M1 M3 using Fig4_TabC7.rtf, replace r2 se label star(* .1 ** .05 *** .01) scalars("ll Log Lik." "chi2 Chi-Squared" aic bic N)  nobaselevels 


*Graph Coefficient Plot (Figure 4 - Top) 
estimates restore M1

coefplot ///
	(M1, keep(1.parfam_CMP_2) ///
	mcolor(maroon) ciopts(color(maroon) recast(rcap)) msymbol(circle)) ///
	(M1, keep(2.parfam_CMP_2) ///
	mcolor(plg3) ciopts(color(plg3) recast(rcap)) msymbol(circle)) ///	
	(M1, keep(3.parfam_CMP_2) ///
	mcolor(plr1) ciopts(color(plr1) recast(rcap)) msymbol(circle)) ///			
	(M1, keep(4.parfam_CMP_2) ///
	mcolor("240 167 10") ciopts(color("240 167 10") recast(rcap)) msymbol(circle)) ///				
	(M1, keep(5.parfam_CMP_2) ///
	mcolor(plb2) ciopts(color(plb2) recast(rcap)) msymbol(circle)) ///
	(M1, keep(6.parfam_CMP_2) ///
	mcolor(dkorange) ciopts(color(dkorange) recast(rcap)) msymbol(circle)) ///
	(M1, keep(7.parfam_CMP_2) ///
	mcolor(black) ciopts(color(black) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_nationalism) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_xenophobia) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_isolationism) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_educ_cat) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(manufacture) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_c_rti) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(offshorable_bl) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_rti_offshor) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(unemployed) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(union) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(female) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M1, keep(n_age) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)), ///
	xline(0, lc(blue)) baselevels ///
	xtitle("Effects on Attitudes Towards Economic Globalization", size(medium)) ///
	legend(off) ///
	coeflabels(1.parfam_CMP_2 = "Populist Left" ///
	2.parfam_CMP_2 = "Green" 3.parfam_CMP_2 = "Social Dem" ///
	4.parfam_CMP_2 = "Liberal" 5.parfam_CMP_2 = "Conservative" ///
	6.parfam_CMP_2 = "Christian Dem" 7.parfam_CMP_2 = "Populist Right") nooffsets
	
graph export "Fig4_Top.png", width(6000) replace	
	

	
*Graph Coefficient Plot (Figure 4 - Bottom)
estimates restore M3

coefplot ///
	(M3, keep(1.parfam_CMP_2) ///
	mcolor(maroon) ciopts(color(maroon) recast(rcap)) msymbol(circle)) ///
	(M3, keep(2.parfam_CMP_2) ///
	mcolor(plg3) ciopts(color(plg3) recast(rcap)) msymbol(circle)) ///	
	(M3, keep(3.parfam_CMP_2) ///
	mcolor(plr1) ciopts(color(plr1) recast(rcap)) msymbol(circle)) ///			
	(M3, keep(4.parfam_CMP_2) ///
	mcolor("240 167 10") ciopts(color("240 167 10") recast(rcap)) msymbol(circle)) ///				
	(M3, keep(5.parfam_CMP_2) ///
	mcolor(plb2) ciopts(color(plb2) recast(rcap)) msymbol(circle)) ///
	(M3, keep(6.parfam_CMP_2) ///
	mcolor(dkorange) ciopts(color(dkorange) recast(rcap)) msymbol(circle)) ///
	(M3, keep(7.parfam_CMP_2) ///
	mcolor(black) ciopts(color(black) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_nationalism) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_xenophobia) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_isolationism) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_educ_cat) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(manufacture) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_c_rti) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(offshorable_bl) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_rti_offshor) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(unemployed) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(union) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(female) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)) ///
	(M3, keep(n_age) ///
	mcolor(gray) ciopts(color(gray) recast(rcap)) msymbol(circle)), ///
	xline(0, lc(blue)) baselevels ///
	xtitle("Effects on Attitudes Towards Political Globalization", size(medium)) ///
	legend(off) ///
	coeflabels(1.parfam_CMP_2 = "Populist Left" ///
	2.parfam_CMP_2 = "Green" 3.parfam_CMP_2 = "Social Dem" ///
	4.parfam_CMP_2 = "Liberal" 5.parfam_CMP_2 = "Conservative" ///
	6.parfam_CMP_2 = "Christian Dem" 7.parfam_CMP_2 = "Populist Right") nooffsets
	
graph export "Fig4_Bottom.png", width(6000) replace	


*------------------------------------------------------------------------------*
log close

*------------------------------------------------------------------------------*
* 							 --- END OF FILE --- 
*------------------------------------------------------------------------------*